<template>
    <template v-for="(item, index) in data" :key="item">
        <div class="card mt-10 b-box" v-if="(item.cooperationMode || '') !== ''">
            <div class="jizhi_img" :class="{ img1: index == '0', img2: index == '1', img3: index == '2' }"></div>
            <div class="mechanism">{{ item.cooperationMode }}</div>
            <div class="content b-box">
                <div class="content_img"></div>

                <template v-if="item.cooperationMode == '分佣'">
                    <div class="header fl-box">
                        <div class="text_box_item fl-box-s-b">
                            <div>成本</div>
                            <div class="line"></div>
                            <div>￥{{ item.costPrice || "- -" }}</div>
                        </div>
                        <div class="price"><span>￥</span>{{ item.price || item.costPrice }}</div>
                        <div class="text_img b-box">售价</div>
                        
                    </div>
                    <div v-if="item.cooperationMode == '分佣'" class="commission fl-box">
                        <div class="titles">佣金</div>
                        <div class="font">
                            {{ item.commission }}% 
                            <template v-if="item.brokerage">+{{item.brokerage }}%</template>
                        </div>
                    </div>
                    
                    <div class="content_items mt-10">
                        【发货机制】{{ item.liveStreamingMechanism }}
                    </div>
                </template>
                <template v-else>
                    <div class="fl-box " style="align-items: center;">
                        <div class="text_box_item fl-box-s-b">
                            <div>成本</div>
                            <div class="line"></div>
                            <div>￥{{ item.costPrice || "- -" }}</div>
                        </div>
                        <div class="content_items ">
                            【发货机制】{{ item.liveStreamingMechanism || "- -" }}
                        </div>
                    </div>

                </template>


            </div>
        </div>
    </template>
</template>
<script setup lang="ts">
import { defineProps } from 'vue'
defineProps({ data: { type: Object, default: () => { } } })
</script>
<style lang="less" scoped>
.card {
    width: 345px;
    background: linear-gradient(134deg, #0064FF 0%, #008FFF 100%);
    border-radius: 10px;
    position: relative;
    padding: 3px;
    font-family: PingFangSC, PingFang SC;
    font-style: normal;



    .jizhi_img {
        width: 45px;
        height: 13px;
        position: absolute;
        top: 10px;
        left: 15px;
    }

    .img1 {
        background: url("@/assets/newui/details/icon_jizhiyibai@2x.png");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }

    .img2 {
        background: url("@/assets/newui/details/icon_jizhierbai@2x.png");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }

    .img3 {
        background: url("@/assets/newui/details/icon_jizhisanbai@2x.png");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }



    .mechanism {
        width: 58px;
        height: 24px;
        background: #EBF4FF;
        border-radius: 0px 10px 0px 10px;
        position: absolute;
        top: 0;
        right: 0;
        color: #0094FF;
        font-weight: 500;
        font-size: 14px;
        line-height: 24px;
        text-align: center;
    }

    .content {
        width: 100%;
        background: linear-gradient(180deg, #AFDEFF 0%, #FFFFFF 20%, #FFFFFF 100%);
        border-radius: 10px;
        padding: 15px 12px 10px 12px;
        margin-top: 33px;
        position: relative;

        .content_img {
            position: absolute;
            width: 64px;
            height: 26px;
            top: -26px;
            right: 67px;

            background: url("@/assets/newui/details/icon_jizhi@2x.png");
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }

        .header {
            align-items: center;
            font-weight: 500;
            font-size: 12px;
            color: #0094FF;
            line-height: 12px;
        }

        .price {
            font-weight: 600;
            font-size: 24px;
            color: #FC2540;
            line-height: 24px;

            span {
                font-weight: 400;
                font-size: 16px;
                line-height: 16px;
            }
        }

        .text_img {
            width: 42px;
            height: 24px;
            font-weight: 400;
            font-size: 14px;
            color: #FFFFFF;
            line-height: 24px;
            text-align: right;
            padding-right: 5px;
            margin-left: 5px;

            background: url("@/assets/newui/details/icon_shoujia@2x.png");
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }

        .commission {
            margin-top: 10px;
            height: 20px;
            background: linear-gradient(136deg, #E9D1A5 0%, #CEA46C 100%);
            border-radius: 5px;
            width: fit-content;

            .titles {
                height: 20px;
                padding: 0 5px;
                background: #1B1714;
                border-radius: 5px;
                font-weight: 400;
                font-size: 12px;
                color: #CEA46C;
                line-height: 20px;
                text-align: center;
            }

            .font {
                min-width: 50px;
                font-weight: 500;
                font-size: 12px;
                color: #1B1714;
                text-align: center;
                line-height: 20px;
                padding: 0 5px;
            }
        }

        .text_box_item {
            padding: 4px 5px;
            border-radius: 5px;
            border: 1px solid #0094FF;
            margin-right: 5px;
            font-weight: 400;
            font-size: 12px;
            color: #0094FF;
            line-height: 12px;

            .line {
                width: 1px;
                background-color: #0094FF;
                height: 12px;
                margin: 0 5px;
            }
        }

        .content_items {
            font-family: PingFangSC, PingFang SC;
            font-weight: 500;
            font-size: 12px;
            color: #0094FF;
            line-height: 12px;
            vertical-align: middle;
        }
    }
}

.fl-box {
    display: flex;
}

.mt-10 {
    margin-top: 10px;
}
.b-box {
    box-sizing: border-box;
}
.fl-box-s-b {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
</style>